package morning.cat;

import morning.cat.model.Tool;
import morning.cat.model.ToolFactoryBean;
import org.springframework.context.support.GenericXmlApplicationContext;

/**
 * @describe: 类描述信息
 * @author: morningcat.zhang
 * @date: 2020/1/14 1:32 PM
 */
public class Starter6 {

	public static void main(String[] args) {
		GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext("META-INF/ToolFactoryBean.xml");
		Tool tool = applicationContext.getBean(Tool.class);
		System.out.println(tool.getId());


		Tool tool2 = applicationContext.getBean(Tool.class);
		System.out.println(tool == tool2);

		ToolFactoryBean toolFactoryBean = applicationContext.getBean(ToolFactoryBean.class);
		System.out.println(toolFactoryBean.getObject());
		System.out.println(toolFactoryBean.getFactoryId());
	}
}
